package com.tihom.security.browser.validate.code.impl;

import org.springframework.social.connect.web.SessionStrategy;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;

/**
 * @author KING
 * @date 2018/9/8 19:26
 */
@Component
public class HttpSessionSessionStrategy implements SessionStrategy {
    public HttpSessionSessionStrategy() {
    }

    @Override
    public void setAttribute(RequestAttributes request, String name, Object value) {
        request.setAttribute(name, value, 1);
    }

    @Override
    public Object getAttribute(RequestAttributes request, String name) {
        return request.getAttribute(name, 1);
    }

    @Override
    public void removeAttribute(RequestAttributes request, String name) {
        request.removeAttribute(name, 1);
    }
}
